using System;
using System.Collections;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;

using SypConst.Garbage;
using SypConst.Path;

namespace SypEngine
{
    [Serializable]
    public class Category : SypGarbageObject
    {
        public int Id;
        public string CategoryTitle = "";
        public List<Album> AlbumList = null;


        public Category() { }

        public Category(string Title)
        {
            //Id = SypGarbage.GenerateId(ref UsedListId);
            Id = SypGarbageConf.Instance().GenerateId();
            CategoryTitle = Title;
        }
    }


    [Serializable]
    public class Album : SypGarbageObject
    {
        public  int id;
        public List<Picture> PicturesList = null;
        public string AlbumTitle = null;
        public string Author = null;
        public DateTime DateCreation;
        public string originalPath = null;

        public Album() { }
        public Album(string title, string originalPath)
        {
            //this.id = SypGarbage.GenerateId(ref UsedListId);
            id = SypGarbageConf.Instance().GenerateId();
            this.AlbumTitle = title;
            DateCreation = DateTime.Now;
            this.originalPath = originalPath;
        }

        public int[] TopMenuPictureIds(int PictureId)
        {
            if (PicturesList != null)
            {
                int[] ReturnTable = new int[5];
                for (int i = 0; i < PicturesList.Count; i++)
                {
                    if (PicturesList[i].Id == PictureId)
                    {
                        ReturnTable[0] = PicturesList[0].Id;
                        ReturnTable[1] = (i == 0) ? PicturesList[0].Id : PicturesList[i - 1].Id;
                        ReturnTable[2] = (i == PicturesList.Count - 1) ? PicturesList[PicturesList.Count - 1].Id : PicturesList[i + 1].Id;
                        ReturnTable[3] = PicturesList[PicturesList.Count - 1].Id;
                        ReturnTable[4] = id;
                        return ReturnTable;
                    }
                }
            }
            return null;
        }
    }

    [Serializable]
    public class Picture : SypGarbageObject
    {
        public int Id;
        public string Title;
        public string originalPath;



        public Picture(){}
       /* public Picture()
        {
            //Id = SypGarbage.GenerateId(ref UsedListId);
            Id = SypGarbageConf.Instance().GenerateId();
        }*/

        public Picture(string title, string originalPath)
        {
            //Id = SypGarbage.GenerateId(ref UsedListId);
            Id = SypGarbageConf.Instance().GenerateId();
            Title = title;
            this.originalPath = originalPath;
        }
    }
}
